package com.example.javaairportflightanalysis.service.impl;

import com.example.javaairportflightanalysis.dao.AuditMapper;
import com.example.javaairportflightanalysis.domin.check.DfdlCheckAD;
import com.example.javaairportflightanalysis.domin.check.TransferCheckAD;
import com.example.javaairportflightanalysis.service.AuditService;
import com.example.javaairportflightanalysis.utils.GroupAndPageUtil;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AuditServiceImpl implements AuditService {
    @Resource
    AuditMapper auditMapper;


    @Override
    public PageInfo searchBy(String dfltFlno, Integer status, Integer pageNum, Integer pageSize) {
        List<DfdlCheckAD> dfdlCheckADS = auditMapper.searchBy(dfltFlno,status);
        PageInfo pageInfo= GroupAndPageUtil.getPageInfo(dfdlCheckADS,pageNum,pageSize);
        return pageInfo;
    }

    @Override
    public PageInfo searchByTransferCheckA(String dfltFlno, Integer status, Integer pageNum, Integer pageSize) {
        List<TransferCheckAD> transferCheckADS = auditMapper.searchByTransferCheckA(dfltFlno, status);
        PageInfo pageInfo= GroupAndPageUtil.getPageInfo(transferCheckADS,pageNum,pageSize);
        return pageInfo;
    }

    @Override
    public PageInfo searchByDfdlCheckD(String dfltFlno, Integer status, Integer pageNum, Integer pageSize) {
        List<DfdlCheckAD> dfdlCheckADS = auditMapper.searchByDfdlCheckD(dfltFlno, status);
        PageInfo pageInfo = GroupAndPageUtil.getPageInfo(dfdlCheckADS, pageNum, pageSize);
        return pageInfo;
    }

    @Override
    public PageInfo searchByTransferD(String dfltFlno, Integer status, Integer pageNum, Integer pageSize) {
        List<TransferCheckAD> transferCheckADS = auditMapper.searchByTransferD(dfltFlno, status);
        PageInfo pageInfo = GroupAndPageUtil.getPageInfo(transferCheckADS, pageNum, pageSize);
        return pageInfo;
    }


}
